package com.dianrui.moonfire.util;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

/**
 * Created by lining on 2017/7/21.
 * 和安装包  手机设备相关的工具类
 */

public class PackageUtils {

    public static String getPackageName(Context context) {//获取包名
        String str = "";
        PackageManager manager = context.getPackageManager();
        try {
            PackageInfo info = manager.getPackageInfo(context.getPackageName(), 0);
            str = info.packageName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return str;
    }
}
